<template name="popup">
	<view @touchmove.stop.prevent="clear" >
		<view class="popup_mask" @touchmove.stop.prevent="clear"></view>
		<view class="popup_content">
			<view class="title">{{title}}</view>
			<scroll-view scroll-y="true" class="explain_text">
				{{content}}
			</scroll-view>

			<view class="button">
				<view class="back" @tap="back" v-if="showCancel">不同意</view>
				<view class="consent text-cyan" @tap="consent">{{confirmText}}</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		name: "protocol",
		props: {
			title: {
				type: String,
				default: '免责声明'
			},
			content: {
				type: String,
				default: '这是一段免责声明的文本，如果长了，就滑动中间的部分。选择同意，选择第三方复选框select；选择取消，选择第三方复选框未选择。这是一段免责声明的文本，如果长了，就滑动中间的部分。选择同意，选择第三方复选框select；选择取消，选择第三方复选框未选择。选择同意，选择第三方复选框select；选择取消，选择第三方复选框未选择。'
			},
			showCancel: {
				type: true,
				default: Boolean
			},
			confirmText: {
				type: String,
				default: '同意'
			},
		},
		methods: {
			// 禁止滚动
			clear() {
				return;
			},
			back() {
				this.$emit('btnState', false)
				
			},
			// 关闭弹框
			consent() {
				this.$emit('btnState', true)
			},
			
		}
	};
</script>

<style lang="scss" scoped>
	.popup_mask {
		position: fixed;
		bottom: 0;
		top: 0;
		left: 0;
		right: 0;
		background-color: rgba(0, 0, 0, 0.4);
		transition-property: opacity;
		transition-duration: 0.3s;
		opacity: 0;
		z-index: 10000;
		
	}

	.popup_mask {
		opacity: 1;
	}

	.popup_content {
		overflow: hidden;
		box-sizing: border-box;
		padding: 40rpx 20rpx 0 20rpx;
		position: fixed;
		bottom: 30%;
		left: 50%;
		margin-left: -220rpx;
		right: 0;
		min-height: 400rpx;
		background: #ffffff;
		width: 440rpx;
		z-index: 10001;

		.title {
			text-align: center;
			font-size: 34rpx;
			padding: 10rpx 0 0 0;
			color: #000000;
			font-weight: 700;
		}

		.explain_text {
			font-size: 24rpx;
			line-height: 38rpx;
			max-height: 350rpx;
			min-height: 200rpx;
			overflow-y: scroll;
			padding: 32rpx;
			margin-bottom: 30rpx;
			color: #505050;
			text-indent: 2em;
		}

		.button {
			display: flex;
			padding: 20rpx;
			align-items: center;
			font-size: 34rpx;
			justify-content: space-around;
			border-top: 1rpx solid #f2f2f2;

			view {
				text-align: center;
				flex: 1;
			}
			.back{
				border-right: 1rpx solid #f2f2f2;
			}
		}
	}
</style>
